home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 125
/
Freelog_MarsAvril2015_No125.iso
/
Musique
/
Quod Libet
/
quodlibet-3.3.0-installer.exe
/
bin
/
quodlibet
/
ext
/
events
/
write_cover.pyc
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2014-12-31
|
3KB
|
73 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.7)
import os
import shutil
from gi.repository import Gtk
from quodlibet import config
from quodlibet.const import USERDIR
from quodlibet.plugins.events import EventPlugin
def get_path():
out = os.path.join(USERDIR, 'current.cover')
return config.get('plugins', __name__, out)
def set_path(value):
config.set('plugins', __name__, value)
class PictureSaver(EventPlugin):
PLUGIN_ID = 'Picture Saver'
PLUGIN_NAME = _('Picture Saver')
PLUGIN_DESC = _('The cover image of the current song is saved to a file.')
PLUGIN_ICON = Gtk.STOCK_SAVE
PLUGIN_VERSION = '0.21'
def plugin_on_song_started(self, song):
outfile = get_path()
if song is None:
try:
os.unlink(outfile)
except EnvironmentError:
pass
cover = song.find_cover()
if cover is None:
try:
os.unlink(outfile)
except EnvironmentError:
pass
f = file(outfile, 'wb')
f.write(cover.read())
f.close()
def PluginPreferences(self, parent):
def changed(entry):
fn = entry.get_text()
try:
shutil.move(get_path(), fn)
except EnvironmentError:
pass
set_path(fn)
hb = Gtk.HBox(spacing = 6)
hb.set_border_width(6)
hb.pack_start(Gtk.Label(label = _('File:')), False, True, 0)
e = Gtk.Entry()
e.set_text(get_path())
e.connect('changed', changed)
hb.pack_start(e, True, True, 0)
return hb